package com.rfsp.common.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.rfsp.common.filter.XssFilter;

/**
 * @author zhangboqing
 * @date 2019-07-28
 * 
 * MVC配置类
 */
//@Configuration
public class FilterConfigurer {

	@Autowired
	XssFilter xssFilter;
    
    /**
     * xss过滤器
     * @return
     */
//    @Bean
    public FilterRegistrationBean<XssFilter> XssFilter() {
    	
        FilterRegistrationBean<XssFilter> registrationBean  = new FilterRegistrationBean<>(xssFilter);
    	
        registrationBean.addUrlPatterns("/*");
        registrationBean.setName("XssFilter");
        registrationBean.setOrder(1);
        registrationBean.setEnabled(true);  
        return registrationBean;
    }
    
    
}

